﻿namespace UnityEditor
{
    using System;
    using System.Runtime.CompilerServices;
    using UnityEngine;

    public sealed class VCProvider
    {
        public static VCTask Add(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Add(assets);
        }

        public static VCTask Add(VCAssetList assets)
        {
            return Internal_Add(assets.ToArray());
        }

        public static bool AddIsValid(VCAssetList assets)
        {
            return Internal_AddIsValid(assets.ToArray());
        }

        public static VCTask ChangeDescription(VCChangelist changelist)
        {
            return Internal_ChangeDescription(changelist);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask ChangeLists();
        public static VCTask ChangeMove(VCAsset asset, string changelistRevision)
        {
            VCChangelist target = new VCChangelist(string.Empty, changelistRevision);
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_ChangeMove(assets, target);
        }

        public static VCTask ChangeMove(VCAsset asset, VCChangelist changelist)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_ChangeMove(assets, changelist);
        }

        public static VCTask ChangeMove(VCAssetList assets, string changelistRevision)
        {
            VCChangelist target = new VCChangelist(string.Empty, changelistRevision);
            return Internal_ChangeMove(assets.ToArray(), target);
        }

        public static VCTask ChangeMove(VCAssetList assets, VCChangelist changelist)
        {
            return Internal_ChangeMove(assets.ToArray(), changelist);
        }

        public static VCTask ChangeStatus(string changelistRevision)
        {
            VCChangelist changelist = new VCChangelist(string.Empty, changelistRevision);
            return Internal_ChangeStatus(changelist);
        }

        public static VCTask ChangeStatus(VCChangelist changelist)
        {
            return Internal_ChangeStatus(changelist);
        }

        public static VCTask Checkout(string asset, CheckoutMode mode)
        {
            string[] assets = new string[] { asset };
            return Internal_CheckoutStrings(assets, mode);
        }

        public static VCTask Checkout(VCAsset asset, CheckoutMode mode)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Checkout(assets, mode);
        }

        public static VCTask Checkout(string[] assets, CheckoutMode mode)
        {
            return Internal_CheckoutStrings(assets, mode);
        }

        public static VCTask Checkout(UnityEngine.Object[] assets, CheckoutMode mode)
        {
            VCAssetList list = new VCAssetList();
            foreach (UnityEngine.Object obj2 in assets)
            {
                VCAsset assetByPath = VCDatabase.GetAssetByPath(AssetDatabase.GetAssetPath(obj2));
                list.Add(assetByPath);
            }
            return Internal_Checkout(list.ToArray(), mode);
        }

        public static VCTask Checkout(VCAssetList assets, CheckoutMode mode)
        {
            return Internal_Checkout(assets.ToArray(), mode);
        }

        public static VCTask Checkout(UnityEngine.Object asset, CheckoutMode mode)
        {
            VCAsset assetByPath = VCDatabase.GetAssetByPath(AssetDatabase.GetAssetPath(asset));
            VCAsset[] assets = new VCAsset[] { assetByPath };
            return Internal_Checkout(assets, mode);
        }

        public static bool CheckoutIsValid(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_CheckoutIsValid(assets);
        }

        public static bool CheckoutIsValid(VCAssetList assets)
        {
            return Internal_CheckoutIsValid(assets.ToArray());
        }

        public static VCTask Delete(string assetProjectPath)
        {
            return Internal_DeleteAtProjectPath(assetProjectPath);
        }

        public static VCTask Delete(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Delete(assets);
        }

        public static VCTask Delete(VCAssetList assets)
        {
            return Internal_Delete(assets.ToArray());
        }

        public static bool DeleteChangeIsValid(VCChanges changelists)
        {
            return Internal_DeleteChangeIsValid(changelists.ToArray());
        }

        public static VCTask DeleteChanges(VCChanges changelists)
        {
            return Internal_DeleteChanges(changelists.ToArray());
        }

        public static VCTask DiffHead(VCAssetList assets)
        {
            return Internal_DiffHead(assets.ToArray());
        }

        public static bool DiffIsValid(VCAssetList assets)
        {
            return Internal_DiffIsValid(assets.ToArray());
        }

        public static VCTask GetLatest(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_GetLatest(assets);
        }

        public static VCTask GetLatest(VCAssetList assets)
        {
            return Internal_GetLatest(assets.ToArray());
        }

        public static bool GetLatestIsValid(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_GetLatestIsValid(assets);
        }

        public static bool GetLatestIsValid(VCAssetList assets)
        {
            return Internal_GetLatestIsValid(assets.ToArray());
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask Incoming();
        public static VCTask IncomingChangeAssets(string changelistRevision)
        {
            VCChangelist changelist = new VCChangelist(string.Empty, changelistRevision);
            return Internal_IncomingChangeAssets(changelist);
        }

        public static VCTask IncomingChangeAssets(VCChangelist changelist)
        {
            return Internal_IncomingChangeAssets(changelist);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Add(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_AddIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_ChangeDescription(VCChangelist changelist);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_ChangeMove(VCAsset[] assets, VCChangelist target);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_ChangeStatus(VCChangelist changelist);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Checkout(VCAsset[] assets, CheckoutMode mode);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_CheckoutIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_CheckoutStrings(string[] assets, CheckoutMode mode);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Delete(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_DeleteAtProjectPath(string assetProjectPath);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_DeleteChangeIsValid(VCChangelist[] changes);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_DeleteChanges(VCChangelist[] changelists);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_DiffHead(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_DiffIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_GetLatest(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_GetLatestIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_IncomingChangeAssets(VCChangelist changelist);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Lock(VCAsset[] assets, bool locked);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_LockIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask Internal_MoveAsStrings(string from, string to);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Refresh(VCAsset[] assets, bool recursively);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Revert(VCAsset[] assets, bool unchangedOnly);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_RevertChanges(VCChangelist[] changelists, bool unchangedOnly);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_RevertIsValid(VCAsset[] assets, bool unchangedOnly);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Status(VCAsset[] assets, bool recursively);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask Internal_StatusAbsolutePath(string assetPath);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_StatusStrings(string[] assetsProjectPaths, bool recursively);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern VCTask Internal_Submit(VCChangelist changelist, VCAsset[] assets, string description, bool saveOnly);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern bool Internal_SubmitIsValid(VCChangelist changelist, VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private static extern bool Internal_UnlockIsValid(VCAsset[] assets);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern bool IsOpenForEdit(VCAsset asset);
        public static VCTask Lock(VCAsset asset, bool locked)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Lock(assets, locked);
        }

        public static VCTask Lock(VCAssetList assets, bool locked)
        {
            return Internal_Lock(assets.ToArray(), locked);
        }

        public static bool LockIsValid(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_LockIsValid(assets);
        }

        public static bool LockIsValid(VCAssetList assets)
        {
            return Internal_LockIsValid(assets.ToArray());
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCPlugin Lookup(string name);
        public static VCTask Move(string from, string to)
        {
            return Internal_MoveAsStrings(from, to);
        }

        public static VCTask Refresh(VCAsset asset, bool recursively)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Refresh(assets, recursively);
        }

        public static VCTask Refresh(VCAssetList assets, bool recursively)
        {
            return Internal_Refresh(assets.ToArray(), recursively);
        }

        public static VCTask Revert(VCAsset asset, bool unchangedOnly)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Revert(assets, unchangedOnly);
        }

        public static VCTask Revert(VCAssetList assets, bool unchangedOnly)
        {
            return Internal_Revert(assets.ToArray(), unchangedOnly);
        }

        public static VCTask RevertChanges(VCChanges changelists, bool unchangedOnly)
        {
            return Internal_RevertChanges(changelists.ToArray(), unchangedOnly);
        }

        public static bool RevertIsValid(VCAsset asset, bool unchangedOnly)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_RevertIsValid(assets, unchangedOnly);
        }

        public static bool RevertIsValid(VCAssetList assets, bool unchangedOnly)
        {
            return Internal_RevertIsValid(assets.ToArray(), unchangedOnly);
        }

        public static VCTask Status(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Status(assets, true);
        }

        public static VCTask Status(string[] assets)
        {
            return Internal_StatusStrings(assets, true);
        }

        public static VCTask Status(VCAssetList assets)
        {
            return Internal_Status(assets.ToArray(), true);
        }

        public static VCTask Status(string asset, bool recursively)
        {
            string[] assetsProjectPaths = new string[] { asset };
            return Internal_StatusStrings(assetsProjectPaths, recursively);
        }

        public static VCTask Status(string[] assets, bool recursively)
        {
            return Internal_StatusStrings(assets, recursively);
        }

        public static VCTask Status(VCAsset asset, bool recursively)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_Status(assets, recursively);
        }

        public static VCTask Status(VCAssetList assets, bool recursively)
        {
            return Internal_Status(assets.ToArray(), recursively);
        }

        public static VCTask StatusAbsolutePath(string asset)
        {
            return Internal_StatusAbsolutePath(asset);
        }

        public static VCTask Submit(VCChangelist changelist, VCAssetList list, string description, bool saveOnly)
        {
            return Internal_Submit(changelist, (list == null) ? null : list.ToArray(), description, saveOnly);
        }

        public static bool SubmitIsValid(VCChangelist changelist, VCAssetList assets)
        {
            return Internal_SubmitIsValid(changelist, (assets == null) ? null : assets.ToArray());
        }

        public static bool UnlockIsValid(VCAsset asset)
        {
            VCAsset[] assets = new VCAsset[] { asset };
            return Internal_UnlockIsValid(assets);
        }

        public static bool UnlockIsValid(VCAssetList assets)
        {
            return Internal_UnlockIsValid(assets.ToArray());
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask UpdatePlugins(bool rescan);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public static extern VCTask UpdateSettings();

        public static VCPlugin[] availablePlugins { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public static bool enabled { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public static bool isActive { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public static bool isPresent { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }
    }
}

